<?php

namespace app\model\office;

use app\model\BaseModel;
use think\model\concern\SoftDelete;

class OfficeDatum extends BaseModel
{
    use SoftDelete;

    /**
     * 数据表主键
     * @var string
     */
    protected $pk = 'id';

    /**
     * 模型名称
     * @var string
     */
    protected $table = 'free_office_datum';
    protected $deleteTime = 'delete_time';
    protected $defaultSoftDelete = '0000-00-00 00:00:00';

    protected $type = [
        'is_dow' => 'boolean'
    ];

    public function OfficeClass()
    {
        return $this->hasOne(OfficeClass::class, 'id', 'class_id');
    }

    public function searchClassIdAttr($query, $value)
    {
        if ($value) $query->where('class_id', $value);
    }

}